# This is configuration file, variable @SOME_VARIABLE_NAME@ will be substituted during configure_file command
cmake_minimum_required(VERSION 3.5)

# If such variables like `CMAKE_CXX_FLAGS` or `CMAKE_CXX_COMPILER` not used by scheme
# setting `LANGUAGES` to `NONE` will speed-up build a little bit. If you have any problems/glitches
# use regular `project(Hunter)` command
project(Hunter LANGUAGES NONE)


include(ExternalProject) # ExternalProject_Add

# some Hunter modules will be used
list(APPEND CMAKE_MODULE_PATH "@HUNTER_SELF@/cmake/modules")

include(hunter_status_debug)
include(hunter_assert_not_empty_string)

# print this message if HUNTER_STATUS_DEBUG option is ON
hunter_status_debug("Scheme: url_sha1_make_only")

# Check variables is not empty
hunter_assert_not_empty_string("@HUNTER_SELF@")
hunter_assert_not_empty_string("@HUNTER_EP_NAME@")
hunter_assert_not_empty_string("@HUNTER_PACKAGE_URL@")
hunter_assert_not_empty_string("@HUNTER_PACKAGE_SHA1@")
hunter_assert_not_empty_string("@HUNTER_PACKAGE_DOWNLOAD_DIR@")
hunter_assert_not_empty_string("@HUNTER_PACKAGE_SOURCE_DIR@")
hunter_assert_not_empty_string("@HUNTER_INSTALL_PREFIX@")


ExternalProject_Add(
	@HUNTER_EP_NAME@ # Name of the external project. Actually not used set for beautify logging messages
	URL
	@HUNTER_PACKAGE_URL@ # URL of the package to download
	URL_HASH
	SHA1=@HUNTER_PACKAGE_SHA1@ # SHA1 hash
	DOWNLOAD_DIR
	"@HUNTER_PACKAGE_DOWNLOAD_DIR@" # Archive destination location
	SOURCE_DIR
	"@HUNTER_PACKAGE_SOURCE_DIR@" # Unpack directory
	INSTALL_DIR
	"@HUNTER_INSTALL_PREFIX@" # not used actually (see install command)
	CONFIGURE_COMMAND
	""
	BUILD_COMMAND
	make PREFIX="@HUNTER_INSTALL_PREFIX@"
	BUILD_IN_SOURCE
	1
	INSTALL_COMMAND
	make PREFIX="@HUNTER_INSTALL_PREFIX@" install
)
